import { history } from '@ice/runtime';

// 清除用户数据并跳转到登录页
export const clearAuthAndRedirect = () => {
  // 清除本地存储的所有数据
  localStorage.removeItem('token');
  localStorage.removeItem('userInfo');
  
  // 如果当前不在登录页，则跳转到登录页
  if (location.pathname !== '/login') {
    window.location.href = '/login';
  }
}; 